<template>
	<div class="hello1">
		<p>count:{{ count }}</p>
		<button @click="setCount(count + 1)">+ 1</button>

		<button @click="setCount(count - 1)">- 1</button>
		<br>
		{{a}}
		<div v-if='flage'>
			adfadfadad
		</div>
		<button @click="chfn">btn</button>
	</div>
</template>

<script>
import { store, mutations } from './store';
export default {
	name: 'Observable',
	data() {
		return {
			a: [1,2,3,4],
			flage:true
		};
	},
	computed: {
		count() {
			return store.count;
		}
	},
	mounted() {},
	methods: {
		setCount: mutations.setCount,
		chfn(){
			this.a=[12]
		}
	},
	watch:{
		a(){
		this.flage=false
			setTimeout(()=>{
				this.flage=true
				console.log(2)
			},0)
			console.log(1)
		}
	}
};
</script>
<style scoped></style>
